//
//  GuideSmallCollectionViewCell.m
//  BeautifulShoppings
//
//  Created by GivenBmli on 16/9/13.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "GuideSmallCollectionViewCell.h"
#import "GuideSmallModel.h"
#import "NetworkHandler.h"
#import "UIView+Frame.h"
#import "TAMacro.h"
@implementation GuideSmallCollectionViewCell
static CGFloat const labelMargin = 15;

- (instancetype)initWithFrame:(CGRect)frame{
    self  = [super initWithFrame:frame];
    if (self) {
        [self creatSubview:frame];
        
    }   
    return self;
}
- (void)setGuideSmallModel:(GuideSmallModel *)guideSmallModel {
    if (_guideSmallModel != guideSmallModel) {

    }
    self.LabelName.text = guideSmallModel.name;
}
- (void)creatSubview:(CGRect)frame {
    self.LabelName = [[UILabel alloc]initWithFrame:CGRectMake(0,0,SCREEN_WIDTH / 6, SCREEN_HEIGHT / 12 )];
    self.LabelName.numberOfLines = NO;
    self.LabelName.textAlignment = 1;
    _LabelName.highlightedTextColor = [UIColor redColor];
    self.LabelName.font = [UIFont systemFontOfSize:17];
    [self.LabelName jxl_setDayMode:^(UIView *view) {
        self.LabelName.backgroundColor = [UIColor whiteColor];
    } nightMode:^(UIView *view) {
        self.LabelName.backgroundColor = [UIColor grayColor];
    }];
    [self.contentView addSubview:self.LabelName];
}

- (void)scrollTitleLabelSelecteded:(UILabel *)label {
    // 取消高亮
    _selectedTitleLabel.highlighted = NO;
    
    // 颜色恢复
    _selectedTitleLabel.textColor = [UIColor blackColor];
    
    // 高亮
    label.highlighted = YES;
    
    _selectedTitleLabel = label;
    // 改变指示器位置
    if (_showsTitleBackgroundIndicatorStyle == YES) {
        [UIView animateWithDuration:0.20 animations:^{
            self.indicatorView.ml_width = label.ml_width - labelMargin;
            self.indicatorView.ml_centerX = label.ml_centerX;
        }];
    } else {
        [UIView animateWithDuration:0.20 animations:^{
            self.indicatorView.ml_width = label.ml_width - 2 * labelMargin;
            self.indicatorView.ml_centerX = label.ml_centerX;
        }];
    }

}

@end
